home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / clipper / ks94an.zip / DAYSBTWN.HDR < prev    next >
Text File  |  1994-04-25  |  3KB  |  93 lines

  1. /******************************************************************************
  2.                  The Klipper Library, for CA-Clipper 5.x
  3.         Copyright (c), 1994, Wallace Information Systems Engineering
  4.  
  5. FUNCTION:
  6.  
  7. _DaysBetween( xDate1, xDate2, nExcludeDays ) --> nDays
  8.  
  9. PARAMETERS:
  10.  
  11. dDate1       : Date of first day
  12. dDate2       : Date of second day
  13. nExcludeDays : Number of days to exclude. (DEFAULT: ZERO)
  14.  
  15. SHORT:
  16.  
  17. Determine days between dates.
  18.  
  19. DESCRIPTION:
  20.  
  21. _DaysBetween() returns the number of days between two dates, optionally
  22. including or excluding the days of the parameter dates themselves and
  23. properly accounting for leap years.
  24.  
  25. The type of the dates may be either date or character. If character, then the
  26. format of the date must be: "MM/DD/YY"  Thus, it is not necessary to convert
  27. character string dates to dates (ala ctod()) before using the function.
  28.  
  29. nExcludeDays is simply subtracted from the return value to exclude either, or
  30. both of the two dates from the result.  Therefore, it may be only 0, 1 or 2.
  31. Any other value will cause the default value of ZERO to be used instead.
  32.  
  33. nExcludeDays may be 1 to exclude  either the start date or the end date (ie,
  34. number of days but NOT including the start date or the end date), or 2 to get
  35. only the number of days in between but not including the parameter dates (ie,
  36. the number of days between the dates but not including the dates themselves).
  37.  
  38. NOTE:
  39.  
  40. If you opt to exclude both the start and the end date (nExcludeDays = 2)
  41. and then test the same two dates, the result will be ZERO, not -2.  Any
  42. time that nExcludeDays causes the result to be negative, the result will
  43. be set to ZERO.
  44.  
  45. The order of the dates is not important.  _DaysBetween('08/01/93','08/15/93')
  46. will work just as well as _DaysBetween('08/15/93','08/01/93').
  47.  
  48. EXAMPLE:
  49.  
  50. ? _DaysBetween('08/01/93','08/15/93')       // 15
  51.  
  52. |-----------------------------------------|
  53. X  X  X  X  X  X  X  X  X  X  X  X  X  X  X
  54.  
  55. 08/01/93                           08/15/93
  56.  
  57.  
  58.  
  59.  
  60. ? _DaysBetween('08/01/93','08/15/93',1)     // 14
  61.  
  62. Excluding either day (begin date or end)
  63.  
  64.    |--------------------------------------|
  65. |--------------------------------------|
  66. X  X  X  X  X  X  X  X  X  X  X  X  X  X  X
  67.  
  68. 08/01/93                           08/15/93
  69.  
  70.  
  71.  
  72.  
  73. ? _DaysBetween('08/01/93','08/15/93',2)     // 13
  74.  
  75. Excluding both begin and end date:
  76.  
  77.  
  78.    |-----------------------------------|
  79. X  X  X  X  X  X  X  X  X  X  X  X  X  X  X
  80.  
  81.  
  82. 08/01/93                           08/15/93
  83.  
  84.  
  85. Other examples:
  86.  
  87. ? _DaysBetween('08/01/93','08/01/93')      // Result: 1
  88. ? _DaysBetween('08/01/93','08/01/93',0)    // Result: 1
  89. ? _DaysBetween('08/01/93','08/01/93',1)    // Result: 0
  90. ? _DaysBetween('08/01/93','08/01/93',2)    // Result: 0
  91.  
  92. ******************************************************************************/
  93.